<?php $this->load->view('admin/public/head.html'); ?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" ng-controller="admin-stream-device-controller">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            直播资源管理
            <small>管理您应用的设备、流量等资源</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active">资源管理</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box">
                    <div class="box-header with-border">
                        <h3 class="box-title">资源列表</h3>
                        <div class="box-tools">
                            <div class="input-group input-group-sm" style="width: 150px;">
                                <input type="text" name="table_search" class="form-control pull-right" placeholder="搜索">

                                <div class="input-group-btn">
                                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                                    <button type="button" class="btn btn-info" ng-click="addDevice()"><i class="fa fa-plus"></i></button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <table class="table table-bordered">
                            <tr>
                                <th class="text-center" style="width: 40px">#</th>
                                <th class="text-center">设备序列号</th>
                                <th class="text-center">设备名称</th>
                                <th class="text-center">分组名称</th>
                                <th class="text-center">添加时间</th>
                                <th class="text-center">通道号</th>
                                <th class="text-center">设备状态</th>
                                <th class="text-center">直播状态</th>
                                <th class="text-center" style="width: 90px">操作</th>
                            </tr>
                            <tr ng-repeat="d in deviceLists">
                                <td class="text-center" ng-bind="d.id"></td>
                                <td class="text-center" ng-bind="d.deviceSerial"></td>
                                <td ng-bind="d.deviceName"></td>
                                <td ng-bind="groupWithId[d.groupId]"></td>
                                <td class="text-center" ng-bind="d.created"></td>
                                <td class="text-center">1xx</td>
                                <td class="text-center" ng-class="{'text-green': d.status, 'text-red': !d.status}" ng-bind="d.status ? '在线' : '离线'"></td>
                                <td class="text-center">直播中</td>
                                <td class="text-center">
                                    <a class="btn btn-link btn-flat btn-xs" href="/stream/device/detail?deviceId={{ d.id }}"><i class="fa fa-pencil"></i> 设置直播</a>
                                </td>
                            </tr>
                            <tr ng-if="deviceLists.length == 0">
                                <td class="text-center" colspan="9"><p class="help-block">暂无数据</p></td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>

        </div>
    </section>
    <!-- /.content -->


    <!--设备管理-->
    <div class="modal fade" id="addDevice">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title">添加资源</h4>
                </div>
                <div class="modal-body">
                    <div class="alert alert-danger alert-dismissible" ng-show="addDeviceError">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                        <p><i class="icon fa fa-ban"></i> <span ng-bind="addDeviceError"></span></p>
                    </div>
                    <form class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">选择分组</label>
                            <div class="col-sm-8">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default btn-flat" ng-bind="add.groupName"></button>
                                    <button type="button" class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown">
                                        <span class="caret"></span>
                                        <span class="sr-only">Toggle Dropdown</span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li ng-repeat="($index, g) in groupLists"><a ng-click="selectGroup($index)" ng-bind="g.groupName"></a></li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="deviceSerial" class="col-sm-2 control-label">设备序列号</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" ng-model="add.deviceSerial" id="deviceSerial" placeholder="设备序列号">
                                <p class="help-block">请查看摄像头机身标签获取</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="validateCode" class="col-sm-2 control-label">设备验证码</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" ng-model="add.validateCode" id="validateCode" placeholder="设备验证码">
                                <p class="help-block">请查看摄像头机身标签获取</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="deviceName" class="col-sm-2 control-label">直播名称</label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" ng-model="add.deviceName" id="deviceName" placeholder="直播名称">
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </form>
                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-info" ng-click="doAddDevice()">立即添加</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</div>
<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array('js' => array(
    '/assets/admin/js/stream/device.js'
))); ?>
